#include <bits/stdc++.h>

#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1e6 + 5;

int n, m;

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  vector<int> cnt(1000001, 0);
  rep(i, 1, n) {
    int x;
    cin >> x;
    cnt[x] = 1;
  }
  auto res = convolution(cnt, cnt);
  ll ans = -n;
  rep(i, 1, 1000000) ans += res[i * 2] * cnt[i];
  ans /= 2;
  cout << ans;
  return 0;
}